import axios from 'axios';
import { reactive,onMounted } from 'vue';

export default function (){
    const dogList = reactive([
        "https://images.dog.ceo//breeds//pembroke//n02113023_12759.jpg"
    ])

    async function getDogList(){
        try {
            const result = await axios.get('https://dog.ceo/api/breed/pembroke/images/random');
            dogList.push(result.data.message);
        } catch (error) {
            console.log(error);
        }
    }

    onMounted(() =>{
        getDogList();
    })

    return {dogList,getDogList}
}